/**
 * 2103. 环和杆
 */
public class No2103 {
    public int countPoints(String rings) {
        boolean[][] rods = new boolean[10][3];
        for (int i = 0; i < rings.length(); i += 2) {
            rods[rings.charAt(i + 1) - '0'][getColor(rings.charAt(i))] = true;
        }
        int ans = 0;
        for (boolean[] rod : rods) {
            if (rod[0] && rod[1] && rod[2]) ans++;
        }
        return ans;
    }

    private int getColor(char rgb) {
        return switch (rgb) {
            case 'R' -> 0;
            case 'G' -> 1;
            case 'B' -> 2;
            default -> throw new IllegalStateException("Unexpected value: " + rgb);
        };
    }
}
